---
// Navbar组件
---

<nav class="navbar">
  <div class="navbar-container">
    <div class="logo">
      <a href="/">
        <i class="fas fa-chart-line logo-icon"></i>
        <span class="logo-text">量化帮</span>
      </a>
    </div>
    <div class="nav-links">
      <a href="/" class="nav-link">
        <i class="fas fa-home"></i> 首页
      </a>
      <a href="/referral" class="nav-link active">
        <i class="fas fa-handshake"></i> 推荐计划
      </a>
      <a href="#" class="nav-link">
        <i class="fas fa-cube"></i> 产品
      </a>
      <a href="#" class="nav-link">
        <i class="fas fa-tag"></i> 定价
      </a>
      <a href="#" class="nav-link">
        <i class="fas fa-info-circle"></i> 关于我们
      </a>
    </div>
    <div class="auth-buttons">
      <a href="#" class="login-btn">
        <i class="fas fa-sign-in-alt"></i> 登录
      </a>
      <a href="#" class="signup-btn">
        <i class="fas fa-user-plus"></i> 注册
      </a>
    </div>
    <button class="mobile-menu-btn" aria-label="菜单">
      <span></span>
      <span></span>
      <span></span>
    </button>
  </div>
</nav>

<script>
  // 移动端菜单切换
  document.addEventListener('DOMContentLoaded', () => {
    const mobileMenuBtn = document.querySelector('.mobile-menu-btn');
    const navLinks = document.querySelector('.nav-links');
    const authButtons = document.querySelector('.auth-buttons');
    
    mobileMenuBtn?.addEventListener('click', () => {
      mobileMenuBtn.classList.toggle('active');
      navLinks?.classList.toggle('active');
      authButtons?.classList.toggle('active');
    });
  });
</script>

<style>
  .navbar {
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px); 
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(0, 102, 204, 0.1);
  }

  .navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
  }

  .logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: transform 0.3s;
  }
  
  .logo a:hover {
    transform: scale(1.05);
  }

  .logo-icon {
    font-size: 1.8rem;
    color: #0066cc;
    margin-right: 0.5rem;
    background: linear-gradient(135deg, #0066cc, #0099ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  .logo-text {
    font-size: 1.5rem;
    font-weight: bold;
    background: linear-gradient(135deg, #0066cc, #0099ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  .nav-links {
    display: flex;
    gap: 1.5rem;
  }

  .nav-link {
    color: #333;
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 0;
    transition: all 0.2s;
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .nav-link:hover, .nav-link.active {
    color: #0066cc;
  }

  .nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    background: linear-gradient(to right, #0066cc, #0099ff);
    bottom: 0;
    left: 0;
    transition: width 0.3s;
  }

  .nav-link:hover::after, .nav-link.active::after {
    width: 100%;
  }

  .auth-buttons {
    display: flex;
    gap: 1rem;
  }

  .login-btn, .signup-btn {
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .login-btn {
    color: #0066cc;
    border: 1px solid #0066cc;
    background-color: transparent;
  }

  .login-btn:hover {
    background-color: rgba(0, 102, 204, 0.08);
    transform: translateY(-2px);
  }

  .signup-btn {
    background: linear-gradient(135deg, #0066cc, #0099ff);
    color: white;
    border: none;
    box-shadow: 0 4px 10px rgba(0, 102, 204, 0.2);
  }

  .signup-btn:hover {
    box-shadow: 0 6px 15px rgba(0, 102, 204, 0.3);
    transform: translateY(-2px);
  }

  .mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
  }

  .mobile-menu-btn span {
    display: block;
    height: 3px;
    width: 100%;
    background-color: #0066cc;
    transition: all 0.3s;
    border-radius: 3px;
  }

  .mobile-menu-btn.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
  }

  .mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
  }

  .mobile-menu-btn.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
  }

  @media (max-width: 768px) {
    .navbar-container {
      flex-wrap: wrap;
      padding: 1rem;
    }

    .mobile-menu-btn {
      display: flex;
    }

    .nav-links, .auth-buttons {
      flex-basis: 100%;
      flex-direction: column;
      overflow: hidden;
      max-height: 0;
      transition: max-height 0.3s ease-out;
    }

    .nav-links.active, .auth-buttons.active {
      max-height: 500px;
      transition: max-height 0.5s ease-in;
    }

    .nav-links {
      margin-top: 1rem;
      gap: 0;
    }

    .nav-link {
      padding: 0.8rem 0;
      border-bottom: 1px solid #eee;
      width: 100%;
      display: flex;
      justify-content: flex-start;
    }

    .auth-buttons {
      margin-top: 0.5rem;
    }

    .login-btn, .signup-btn {
      text-align: center;
      margin: 0.5rem 0;
      width: 100%;
      display: flex;
      justify-content: center;
      box-sizing: border-box;
    }
  }
</style> 